package com.zone.modular.system.sysuser.controller;


import com.zone.config.mybatis.Result;
import com.zone.modular.system.sysuser.entity.Shishigaikuang;
import com.zone.modular.system.sysuser.service.ShishigaikuangService;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZoneWonderful
 * @since 2022-08-23
 */
@RestController
@RequestMapping("/shishigaikuang")
public class ShishigaikuangController {
    @Autowired
    private ShishigaikuangService shishigaikuangService;

    @GetMapping("/getData")
    public Result getData(String state){
        return Result.ok(shishigaikuangService.getData(state));
    }

    @PostMapping("/upload")
    public Result uploadExcel(MultipartFile file) throws IOException {
        shishigaikuangService.handleImport(file);
        return Result.ok();
    }
}

